package com.ruoyi.fitsculpt.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fitsculpt.mapper.EasyfitFoodsMapper;
import com.ruoyi.fitsculpt.domain.EasyfitFoods;
import com.ruoyi.fitsculpt.service.IEasyfitFoodsService;

/**
 * 食物库Service业务层处理
 *
 * @author metaee
 * @date 2025-02-27
 */
@Service
public class EasyfitFoodsServiceImpl implements IEasyfitFoodsService {
    @Autowired
    private EasyfitFoodsMapper easyfitFoodsMapper;

    /**
     * 查询食物库
     *
     * @param foodId 食物库主键
     * @return 食物库
     */
    @Override
    public EasyfitFoods selectEasyfitFoodsByFoodId(Long foodId) {
        return easyfitFoodsMapper.selectEasyfitFoodsByFoodId(foodId);
    }

    /**
     * 查询食物库列表
     *
     * @param easyfitFoods 食物库
     * @return 食物库
     */
    @Override
    public List<EasyfitFoods> selectEasyfitFoodsList(EasyfitFoods easyfitFoods) {
        return easyfitFoodsMapper.selectEasyfitFoodsList(easyfitFoods);
    }

    /**
     * 新增食物库
     *
     * @param easyfitFoods 食物库
     * @return 结果
     */
    @Override
    public int insertEasyfitFoods(EasyfitFoods easyfitFoods) {
        easyfitFoods.setCreateTime(DateUtils.getNowDate());
        return easyfitFoodsMapper.insertEasyfitFoods(easyfitFoods);
    }

    /**
     * 修改食物库
     *
     * @param easyfitFoods 食物库
     * @return 结果
     */
    @Override
    public int updateEasyfitFoods(EasyfitFoods easyfitFoods) {
        easyfitFoods.setUpdateTime(DateUtils.getNowDate());
        return easyfitFoodsMapper.updateEasyfitFoods(easyfitFoods);
    }

    /**
     * 批量删除食物库
     *
     * @param foodIds 需要删除的食物库主键
     * @return 结果
     */
    @Override
    public int deleteEasyfitFoodsByFoodIds(Long[] foodIds) {
        return easyfitFoodsMapper.deleteEasyfitFoodsByFoodIds(foodIds);
    }

    /**
     * 删除食物库信息
     *
     * @param foodId 食物库主键
     * @return 结果
     */
    @Override
    public int deleteEasyfitFoodsByFoodId(Long foodId) {
        return easyfitFoodsMapper.deleteEasyfitFoodsByFoodId(foodId);
    }
}
